#pragma once
#include "hashTable.h"

namespace m_std
{
    template <class K, class Hash = HashFun<K>>
    class unordered_set
    {
    private:
        struct setOfValue
        {
            const K &operator()(const K &data)
            {
                return data;
            }
        };

    public:
        typedef typename HashTable<K, K, Hash, setOfValue>::iterator iterator;
        iterator begin()
        {
            return _ht.begin();
        }
        iterator end()
        {
            return _ht.end();
        }
        pair<iterator, bool> insert(const K &data)
        {
            return _ht.insert(data);
        }
        size_t size() const
        {
            return _ht.size();
        }
        size_t bucketSize() const
        {
            return _ht.bucketSize();
        }
        size_t bucketNum() const
        {
            return _ht.bucketNum();
        }
        size_t maxBucketLenth() const
        {
            return _ht.maxBucketLenth();
        }

    private:
        HashTable<K, K, Hash, setOfValue> _ht;
    };
    void test_set()
    {
        unordered_set<int> hashSet;
        hashSet.insert(1);
        hashSet.insert(2);
        hashSet.insert(3);
        hashSet.insert(4);
        for(auto val : hashSet){
            cout << val << endl;
        }
    }
};